﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Tradex.Trading;

namespace Tradex.Messages {
    
    /// <summary>
    /// This message is transported from the user interface to the TradingService and back all end to the connectors. It
    /// requests a change or cancel of an existing message.
    /// </summary>
    [Serializable ()]
    public sealed class OrderModificationRequestMessage : Message {

        /// <summary>
        /// Constructor taking all values.
        /// </summary>
        /// <param name="orderKey"></param>
        /// <param name="orderConnectionKey"></param>
        /// <param name="orderModification"></param>
        public OrderModificationRequestMessage(
            OrderKey orderKey,
            OrderId orderConnectionKey,
            OrderModification orderModification
        ) {
            OrderKey = orderKey;
            ConnectionKey = orderConnectionKey;
            Modification = orderModification;
        }

        /// <inheritdoc />
        public override MessageCode Code { get { return MessageCode.OrderModificationRequest; } }

        /// <summary>
        /// Gets the OrderKey
        /// </summary>
        public OrderKey OrderKey { get; private set; }

        /// <summary>
        /// Gets the ConnectionKey
        /// </summary>
        public OrderId ConnectionKey { get; private set; }

        /// <summary>
        /// Gets the OrderInfo
        /// </summary>
        public OrderInfo OrderInfo { get; private set; }

        /// <summary>
        /// This is the requested modification. A null value at this structure results in a cancel (as it logically
        /// turns the requested values to invalid).
        /// </summary>
        public OrderModification Modification { get; private set; }

    }

}
